home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Stuff / 3D_Reality / 3D_Reality_API / Examples / Quadric / Quadric.m < prev    next >
Encoding:
Text File  |  1992-10-25  |  1.6 KB  |  90 lines

  1. /*************************************************************************
  2. *    Copyright (c) 1989-1992 Stone Design Corp.  All rights reserved. 
  3. *    programmer:    Andrew C. Stone
  4. *    File name:    Quadric.m
  5. *    Date:        May 24 1992 
  6. *    Purpose:    Round up stuff that all quadrics seem to share 
  7. ***************************************************************************/
  8. #import <3dreality_api.h>
  9.  
  10. @implementation Quadric
  11. - init
  12. {
  13.     [super init];
  14.     return self;
  15. }
  16.  
  17. ////////////////////////////////////////////////////////////////////
  18. //            Get/Set
  19. ///////////////////////////////////////////////////////////////////
  20.  
  21. - (RtFloat)radius
  22. {
  23.     return radius;
  24. }
  25.  
  26. - (RtFloat)zMax
  27. {
  28.     return zMax;
  29. }
  30.  
  31. - (RtFloat)zMin
  32. {
  33.     return zMin;
  34. }
  35.  
  36. - (RtFloat)thetaMax
  37. {
  38.     return thetaMax;
  39. }
  40.  
  41.  
  42. - setRadius:(RtFloat *)r
  43. {
  44.     radius = r?*r:0.;
  45.     [self calcBoundingBox];
  46.     return self;
  47. }
  48.  
  49. - setThetaMax:(RtFloat *)tmax
  50. {
  51.     thetaMax = tmax?*tmax:0.;
  52.     [self calcBoundingBox];
  53.     return self;
  54. }
  55.  
  56. - setZMax:(RtFloat *)z
  57. {
  58.     zMax = z?*z:0.;
  59.     [self calcBoundingBox];
  60.     return self;
  61. }
  62.  
  63. - setZMin:(RtFloat *)z
  64. {
  65.     zMin = z?*z:0.;
  66.     [self calcBoundingBox];
  67.     return self;
  68. }
  69.  
  70.  
  71. ////////////////////////////////////////////////////////////////////
  72. //            Archive
  73. ///////////////////////////////////////////////////////////////////
  74.  
  75. - read:(NXTypedStream *)stream
  76. {
  77.     [super read:stream];
  78.     NXReadTypes(stream,"ffff",&radius,&zMin,&zMax,&thetaMax);
  79.     return self;
  80. }
  81.  
  82.  
  83. - write:(NXTypedStream *)stream
  84. {
  85.     [super write:stream];
  86.     NXWriteTypes(stream,"ffff",&radius,&zMin,&zMax,&thetaMax);
  87.     return self;
  88. }
  89. @end
  90.